package com.yjjxt

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object Hello14RDD {
  def main(args: Array[String]): Unit = {
    val sparkContext = new SparkContext((new SparkConf().setMaster("local").setAppName("Join" + System.currentTimeMillis())))

    val array1 = Array[String]("Hello1 user1", "Hello2 user1", "Hello user11", "Hello user12", "user1 apple1")
    val lines1: RDD[String] = sparkContext.parallelize(array1, 3)
    val words1: RDD[(String, String)] = lines1.map(ele => (ele.split(" ")(0), ele.split(" ")(1)))
    lines1.map(x => {
      println(x)
      x
    })

    words1.foreach(e => println("words1--" + e))

  }
}
